package in.co.codedoc.tests;

import in.co.codedoc.ioc.IOCContainer;
import in.co.codedoc.sql.DBInteractions;

import org.junit.After;
import org.junit.Before;

public class JUNitTestBase
{
	@Before
	public void SetUpIOC()
	{
		IOCContainer.ScanClasspath();
		IOCContainer.InitializeComponents();
		IOCContainer.StartComponents();

		if(DBInteractions.IsConfigured())
		{
			DBInteractions.StartTransaction();
		}
	}
	
	@After
	public void ShutdownIOC()
	{
		if(DBInteractions.IsConfigured())
		{
			DBInteractions.CommitOrRollback();
		}
		IOCContainer.ShutdownComponents();
	}
}
